<template>
  <div class="father">
    <div class="biaoti">业务信息:</div><br/>
    <div class="neirong">业务id:<input class="readonly" type="text" readonly :value="service.serviceid"/></div>
    <div class="neirong">业务编号:<input class="readonly" type="text" readonly :value="service.servicenumber" /></div>
    <div class="neirong">业务类型:<input class="readonly" type="text" readonly :value="service.servicetype"/></div>
    <br/>
    <div class="biaoti">申请人基本信息:</div><br/>
    <div class="neirong">申请人:<input class="readonly" type="text" readonly :value="proposer.clientname"/></div>
    <div class="neirong">申请人身份证号码:<input class="readonly" type="text" readonly  :value="proposer.idcard"/></div>
    <div class="neirong" style="padding-right: 30%">联系电话:<input class="readonly" type="text" readonly :value="proposer.phone"/></div>
    <br/>
    <div class="neirong">代理人:<input class="readonly" type="text" readonly :value="agent.clientname"/></div>
    <div class="neirong">代理人身份证号码:<input class="readonly" type="text" readonly :value="agent.idcard"/></div>
    <br/>
    <div class="biaoti">房产信息:</div><br/>
    <div class="shuru">房屋门牌号:<input type="text" id="roomnumber" /><input  class="button" type="button" value="查询" @click="findroom()"/></div>
    <div class="neirong">总面积:<input class="readonly" type="text" readonly :value="building.totalarea"/></div>
    <div class="neirong">楼层:<input class="readonly" type="text" readonly :value="building.floor" /></div>
    <div class="neirong" style="padding-right: 30%">楼栋名称:<input class="readonly" type="text" readonly :value="building.buildingname"/></div>
    <div class="neirong">楼栋编号:<input class="readonly" type="text" readonly :value="building.buildingnumber"/></div>
    <div class="neirong">分户房屋:<input class="readonly" type="text" readonly :value="building.count"/></div>

    <div class="biaoti">交验证件:</div><br/>
    <div class="shuru1">登记申请书:<input type="file" id="application"/></div>
    <div class="shuru1">身份证复印件:<input type="file" id="idcopypath"/></div>
    <div class="shuru1">税证复印件:<input type="file" id="taxcopypath"/></div>
    <div class="shuru"><input type="button" value="提交审核" class="button1" @click="tijiao()"/></div>
  </div>
</template>

<script>
export default {
  name: "ysLuRu",
  props: ['params'],
  data() {
    return {
      sid: this.params.id,
      service: {
        servicenumber: null,
        serviceid: null,
        servicetype: null,
        proposer: null,
        agent :null
      },
      proposer: {
        clientname: null,
        idcard: null,
        phone: null,
      },
      agent: {
        clientname: null,
        idcard: null,
      },
      building: {
        buildingid: null,
        buildingname: null,
        buildingnumber: null,
        floor: null,
        count: null,
        totalarea: null,
        descripe: null,
        hid: null
      },
      room: {
        roomid: null,
        roomnumber: null
      }
    }
  },
  mounted() {
    this.show();
  },
  methods: {
    show() {
      this.sa.ajax("/cha/yg?serviceid=" + this.sid, {},
          function (resp) {
            console.log(resp);
            this.service.serviceid = resp.data.service.serviceid;
            this.service.servicenumber = resp.data.service.servicenumber;
            this.service.servicetype = resp.data.servicetype.servicetype;
            this.service.agent = resp.data.service.agent;
            this.service.proposer = resp.data.service.proposer;
            this.service.servicetype = resp.data.servicetype.servicetype;
            this.proposer.clientname = resp.data.proposer.clientname;
            this.proposer.idcard = resp.data.proposer.idcard;
            this.proposer.phone = resp.data.proposer.phone;
            this.agent.clientname = resp.data.agent.clientname;
            this.agent.idcard = resp.data.agent.idcard;
          }.bind(this),
          {type: 'get'}
      )
    },
    findroom() {
      var i = $("#roomnumber").val();
      this.sa.ajax("/cha/fang?roomnumber=" + i, {},
          function (resp) {
            if (resp.msg == 'success') {
              this.building.buildingid = resp.data.building.buildingid;
              this.building.buildingname = resp.data.building.buildingname;
              this.building.buildingnumber = resp.data.building.buildingnumber;
              this.building.floor = resp.data.building.floor + '层';
              this.building.count = resp.data.building.count;
              this.building.totalarea = resp.data.building.totalarea + '平方';
              this.building.descripe = resp.data.building.descripe;
              this.building.hid = resp.data.building.hid;
              this.room.roomid = resp.data.room.roomid;
            } else {
              alert("未查询出数据");
              this.building.buildingid = '';
              this.building.buildingname = '';
              this.building.buildingnumber = '';
              this.building.floor = '';
              this.building.count = '';
              this.building.totalarea = '';
              this.building.descripe = '';
              this.building.hid = '';
            }

          }.bind(this),
          {type: 'get'}
      )
    },
    tijiao() {
      this.findroom();
      if (this.building.floor != '') {
        var sq = $("#sqs").val()+"";
        var sqs = sq.split('\\');
        var sf = $("#sfz").val()+"";
        var sfz = sf.split('\\');
        var s = $("#sz").val()+"";
        var sz = s.split('\\')

        this.sa.ajax("/yewu/yg", {

              serviceid: this.sid,
              proposer:this.service.proposer,
              agent:this.service.agent,
              procard:this.proposer.idcard,
              agecard:this.proposer.idcard,
              applicationpath: sqs[sqs.length - 1],
              idcopypath: sfz[sfz.length - 1],
              taxcopypath: sz[sz.length - 1],
              photo: this.room.roomid
            },
            function () {

                alert("提交成功，信息已入库");
                var tab = {id: 'ShenHe', name: '审核', view: () => import('@/sa-view/jkt/LuRu/syqLuRu.vue'), params: {}};
                this.sa_admin.showTab(tab);

            }
        ).bind(this),
            {type: 'post'}
      }
    }
  }
}
</script>

<style scoped>
.readonly{
  background-color: gray;
  color : white;
}
.father{
  width: 95%;
  height: 800px;
  padding-left: 5%;
}
.biaoti{
  float: left;
  padding-top: 1.5%;
  border-bottom: 1px solid black;
  width: 100%;
}
.neirong{
  float: left;
  padding-right: 2.5%;
  padding-top: 0.5%;
}
.button{
  border-radius: 10px;
  background-color: #42b983;
  color: white;
  border: 2px seagreen solid;
  width: 60px;
  height: 25px;
}
.button1{
  border-radius: 2px;
  background-color: cornflowerblue;
  color: white;
  border: 2px darkblue solid;
  width: 70px;
  height: 25px;
}
.shuru{
  float: left;
  padding-top: 1.5%;
  width: 100%;
}
.shuru1{
  float: left;
  padding-top: 1.5%;
  width: 50%;
}
</style>
